package com.wits.platform.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import net.sf.json.JSONObject;
import net.sf.json.JsonConfig;
import net.sf.json.util.PropertyFilter;

import com.wits.platform.common.JsonDateValueProcessor;
import com.wits.platform.common.constants.SysTabConstants;

@Entity
@Table(name = "wits_company")
public class Company extends BaseEntity{

	/**
	 * 
	 */
	private static final long serialVersionUID = 5785897876972589220L;

	public Company(){
		
	}
	/**
	 * 公司代码
	 */
	private String cpnId;
	
	/**
	 * 公司名称
	 */
	private String cpnName;
	
	/**
	 * 公司英文名称
	 */
	private String cpnNameE;
	
	/**
	 * 公司代号
	 */
	private String cpnCode;
	
	/**
	 * 是否启用
	 */
	private String isEnable=SysTabConstants.SYSTAB_D_TNF_F;

	@Id
	@Column(name="cpn_id",length=36)
	public String getCpnId() {
		return cpnId;
	}

	public void setCpnId(String cpnId) {
		this.cpnId = cpnId;
	}

	@Column(name="cpn_name",length=100)
	public String getCpnName() {
		return cpnName;
	}

	public void setCpnName(String cpnName) {
		this.cpnName = cpnName;
	}

	@Column(name="cpn_name_e",length=100)
	public String getCpnNameE() {
		return cpnNameE;
	}

	public void setCpnNameE(String cpnNameE) {
		this.cpnNameE = cpnNameE;
	}

	@Column(name="cpn_code",length=20)
	public String getCpnCode() {
		return cpnCode;
	}

	public void setCpnCode(String cpnCode) {
		this.cpnCode = cpnCode;
	}

	@Column(name="is_enable",length=1)
	public String getIsEnable() {
		return isEnable;
	}

	public void setIsEnable(String isEnable) {
		this.isEnable = isEnable;
	}

	@Override
	public String display() {
		return this.cpnName;
	}

	
	private static JsonConfig jsonConfig = new JsonConfig();

	@Transient
	protected JsonConfig getJsonConfig() {
		return jsonConfig;
	}

	static {
		jsonConfig.registerJsonValueProcessor(Date.class , new JsonDateValueProcessor());
	}
	
	@Override
	public String toString() {
		return JSONObject.fromObject(this,jsonConfig).toString();
	}

}
